﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class Khampha : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            GetNewsSlide();
            GetHotNews();
            GetNewestNews1();
            GetNewestNews2();
            GetNewestNews3();
            GetOtherNews1();
            GetOtherNews2();
            GetOtherNews3();
            GetTopPoster();
        }
    }
    protected void GetNewsSlide()
    {
        try 
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetAllSlideNews";
            DataTable db = Dal.GetDataTable();
            rptSlideImage.DataSource = db;
            rptSlideImage.DataBind();
            rptSlideDes.DataSource = db;
            rptSlideDes.DataBind();
        }
        catch { }
    }
    protected void GetHotNews()
    {
        try 
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetTopHotNews";
            DataTable db = Dal.GetDataTable();
            rptTopHotNews.DataSource = db;
            rptTopHotNews.DataBind();
        }
        catch { }
    }
    protected void GetNewestNews1()
    {
        try 
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetNewsNewest1";
            DataTable db = Dal.GetDataTable();
            Repeater1.DataSource = db;
            Repeater1.DataBind();
        }
        catch { }
    }
    protected void GetNewestNews2()
    {
        try
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetNewsNewest2";
            DataTable db = Dal.GetDataTable();
            Repeater3.DataSource = db;
            Repeater3.DataBind();
        }
        catch { }
    }
    protected void GetNewestNews3()
    {
        try
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetNewsNewest3";
            DataTable db = Dal.GetDataTable();
            Repeater5.DataSource = db;
            Repeater5.DataBind();
        }
        catch { }
    }
    protected void GetOtherNews1()
    {
        try 
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_Get4RecentNews1";
            DataTable db = Dal.GetDataTable();
            Repeater2.DataSource = db;
            Repeater2.DataBind();
        }
        catch { }
    }
    protected void GetOtherNews2()
    {
        try
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_Get4RecentNews2";
            DataTable db = Dal.GetDataTable();
            Repeater4.DataSource = db;
            Repeater4.DataBind();
        }
        catch { }
    }
    protected void GetOtherNews3()
    {
        try
        {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_Get4RecentNews3";
            DataTable db = Dal.GetDataTable();
            Repeater6.DataSource = db;
            Repeater6.DataBind();
        }
        catch { }
    }
    protected void GetTopPoster()
    {
        try {
            SQLHelper Dal = new SQLHelper();
            Dal.CommandType = CommandType.StoredProcedure;
            Dal.CommandText = "SP_GetTopPoster";
            DataTable db = Dal.GetDataTable();
            rptTopPoster.DataSource = db;
            rptTopPoster.DataBind();
        }
        catch { }
    }
}
